import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.List;

public class ObjectOutputTest {
    public static void main(String[] args) throws Exception {
        Student student = new Student("颤三",22);
        List<Student> list = new ArrayList<>();
        list.add(new Student("李四",55));
        list.add(new Student("sss",11));
        list.add(new Student("sddff",21));

        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("Students"));
        oos.writeObject(list);
        oos.flush();
        oos.close();
    }
}
